import request from '@/utils/request'
//分页查询
export const getPageAPI = (pageNum, pageSize, queryDto) => {
  return request({
    url: `/api/role/page/${pageNum}/${pageSize}`,
    method: 'post',
    data: queryDto,
  })
}
//添加角色
export const saveRoleAPI = data => {
  return request({
    url: '/api/role/save',
    method: 'post',
    data,
  })
}

//修改角色
export const updateRoleAPI = data => {
  return request({
    url: '/api/role/update',
    method: 'put',
    data,
  })
}

//删除角色
export const deleteRoleAPI = id => {
  return request({
    url: `/api/role/delete/${id}`,
    method: 'DELETE',
  })
}

//查询所有的角色
export const getRoleAllAPI = userId => {
  return request({
    url: `/api/role/findAll/${userId}`,
    method: 'get',
  })
}

//分配菜单
export const getFindByRoleIdAssignMenu = roleId => {
  return request({
    url: `/api/role/findByRoleIdAssignMenu/${roleId}`,
    method: 'get',
  })
}

//保存分配的菜单
export const postSaveAssignMenu = assignMenuDto => {
  return request({
    url: '/api/role/saveAssignMenu',
    method: 'post',
    data: assignMenuDto,
  })
}